Skip to content

Conversation

natemort
Copy link
Member

@natemort natemort commented Aug 7, 2025

Update Sessions to use Ephemeral TaskLists behind a feature flag. This ensures that the per-host TaskList is automatically removed once it is no longer used.

This should only be enabled once the server fully supports Ephemeral TaskLists as it will otherwise return errors for the unknown TaskListKind.

What changed?

  • Added support for dispatching session activities to ephemeral TaskLists and polling Ephemeral TaskLists

Why?

  • To support automatically removing session and integration test TaskLists when they're no longer used.

How did you test it?

  • Unit/integration test. Will run through canary tests before enabling.

Potential risks

  • Errors in task polling would significantly impact users, so this is a high risk change.

Detailed Description
See above.

Impact Analysis

  • Backward Compatibility:
  • Forward Compatibility: [Analysis of forward compatibility]

Testing Plan

Rollout Plan

  • What is the rollout plan? Enable where fully rolled out on the server
  • Does the order of deployment matter? Server must support this feature before it is enabled clientside, otherwise poll requests will return an error.
  • Is it safe to rollback? Does the order of rollback matter? Safe to roll back
  • Is there a kill switch to mitigate the impact immediately? Disabling the flag.

Copy link

codecov bot commented Aug 8, 2025

Codecov Report

❌ Patch coverage is 96.07843% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.11%. Comparing base (2737bd0) to head (cd4590f).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
internal/internal_event_handlers.go 50.00% 2 Missing ⚠️

❌ Your project check has failed because the head coverage (83.11%) is below the target coverage (85.00%). You can increase the head coverage or adjust the target coverage.

Files with missing lines Coverage Δ
internal/activity_task_handler.go 96.77% <100.00%> (ø)
internal/client.go 76.06% <100.00%> (+0.20%) ⬆️
internal/internal_activity.go 62.15% <ø> (ø)
internal/internal_task_handlers.go 81.92% <100.00%> (+0.03%) ⬆️
internal/internal_task_pollers.go 86.07% <100.00%> (ø)
internal/internal_utils.go 77.70% <ø> (ø)
internal/internal_worker.go 82.59% <100.00%> (+5.98%) ⬆️
internal/internal_worker_base.go 78.41% <ø> (+6.16%) ⬆️
internal/workflow.go 76.58% <100.00%> (+0.14%) ⬆️
internal/workflow_replayer.go 77.82% <100.00%> (+0.30%) ⬆️
... and 2 more

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2737bd0...cd4590f. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@natemort natemort force-pushed the ephemeral branch 3 times, most recently from 4ef39f0 to 79c12c6 Compare September 15, 2025 22:26
if options != nil {
return FeatureFlags{
WorkflowExecutionAlreadyCompletedErrorEnabled: options.FeatureFlags.WorkflowExecutionAlreadyCompletedErrorEnabled,
PollerAutoScalerEnabled: options.FeatureFlags.PollerAutoScalerEnabled,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a comment: this flag is no longer used and I'll delete it in the next PR


func (ts *IntegrationTestSuite) TestSession_Ephemeral() {
// Ephemeral TaskList is enabled by the test name
ts.TestSession()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can describe tasklist to ensure the tasklist is gone.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TTL is rather high unfortunately. We can't really validate that behavior without inspecting the database directly.

}
defer workflow.CompleteSession(sessionCtx)
var expected string
if err = workflow.ExecuteActivity(ctx, "Prefix_ToUpper", "hello").Get(ctx, &expected); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be sessionCtx

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks

Comment on lines 597 to 616
func (ts *IntegrationTestSuite) TestSession_Ephemeral() {
// Ephemeral TaskList is enabled by the test name
ts.TestSession()
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could do verification

Suggested change
func (ts *IntegrationTestSuite) TestSession_Ephemeral() {
// Ephemeral TaskList is enabled by the test name
ts.TestSession()
}
func (ts *IntegrationTestSuite) TestSession_Ephemeral() {
// Ephemeral TaskList is enabled by the test name
execution, err := ts.executeWorkflow("test-session", ts.workflows.Session, nil)
ts.NoError(err)
taskList := ts.getActivityTaskList(execution)
ts.Equal(shared.TaskListKindEphemeral, taskList.GetKind())
taskList = ts.describeTaskList(taskList.GetName())
ts.Equal(shared.TaskListKindEphemeral, taskList.GetKind())
}
func (ts *IntegrationTestSuite) getActivityTaskList(execution *workflow.Execution) *shared.TaskList {
iter := ts.libClient.GetWorkflowHistory(context.Background(), execution.ID, execution.RunID, false, shared.HistoryEventFilterTypeAllEvent)
for iter.HasNext() {
event, err := iter.Next()
ts.Require().NoError(err)
if event.GetActivityTaskScheduledEventAttributes() != nil {
return event.GetActivityTaskScheduledEventAttributes().GetTaskList()
}
}
return nil
}
func (ts *IntegrationTestSuite) describeTaskList(taskListName string) *shared.TaskList {
descResp, err := ts.libClient.DescribeTaskList(context.Background(), taskListName, shared.TaskListTypeActivity)
ts.Require().NoError(err)
return descResp.GetTaskList()
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline and added. The workflow now returns the TaskList the activity ran on, which we can check.

@natemort natemort force-pushed the ephemeral branch 6 times, most recently from c4aa7f0 to cd46896 Compare September 17, 2025 15:11
Update Sessions to use Ephemeral TaskLists behind a feature flag. This ensures that the per-host TaskList is automatically removed once it is no longer used.

This should only be enabled once the server fully supports Ephemeral TaskLists as it will otherwise return errors for the unknown TaskListKind.

Signed-off-by: Nathanael Mortensen <[email protected]>
@natemort natemort merged commit 7e2e45d into cadence-workflow:master Sep 17, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants